﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Helpers
{
    public class FormatHelper
    {
        public static string ClassTostring<T>(T entity,string format) where T:class
        {
            StringBuilder result = new StringBuilder();
            Type type = typeof(T);
            foreach (var item in type.GetProperties())
            {
                result.AppendFormat(format, item.Name, item.GetValue(entity, null));
            }
            return result.ToString();
        }
    }
}
